package oop.java0329.work2;
//    private 车辆检测中心（有电话，地址等属性）检测车辆的方法都是一样的：检测车辆的启动，加速，刹车是否正常。

public class CarTest {
    private String name;
    private String phone;
    private String address;

    public CarTest() {
    }

    public CarTest(String name, String phone, String address) {
        this.name = name;
        this.phone = phone;
        this.address = address;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
    public void test(Object obj){
        if(obj instanceof Dazhong){
            System.out.println("车身颜色："+((Dazhong)obj).getColor()+",车牌："+((Dazhong)obj).getPlate());
            ((Dazhong)obj).start();
            ((Dazhong)obj).speed();
            ((Dazhong)obj).stop();
            System.out.println("一切正常");
        }else if(obj instanceof Benz){
            System.out.println("车身颜色："+((Benz)obj).getColor()+",车牌："+((Benz)obj).getPlate());
            ((Benz)obj).start();
            ((Benz)obj).speed();
            ((Benz)obj).stop();
            System.out.println("一切正常");

        }else if(obj instanceof Wuling){
            System.out.println("车身颜色："+((Wuling)obj).getColor()+",车牌："+((Wuling)obj).getPlate());
            ((Wuling)obj).start();
            ((Wuling)obj).speed();
            ((Wuling)obj).stop();
            ((Wuling)obj).lahuo();
            System.out.println("一切正常");
        }

    }

    public static void main(String[] args) {
        CarTest test = new CarTest("车管所","4688328","合肥");
        Dazhong dazhong = new Dazhong("银灰色","76515");
        Benz benz = new Benz("红色","88888");
        Wuling wuling = new Wuling("灰色","53214");

        test.test(dazhong);
        System.out.println("-------------------------------");
        test.test(benz);
        System.out.println("-------------------------------");
        test.test(wuling);

    }
}
